import pygame
from settings import Settings


class Ship:
    #飞机管理
    def __init__(self,ai_game):
        #飞机大小，速度，等级
        self.height=Settings().ship_height
        self.weight=Settings().ship_weight
        self.speed = Settings().ship_speed

        #初始化飞机并找到其初始位置
        self.screen = ai_game.screen
        self.screen_rect = ai_game.screen.get_rect()

        #加载飞机图片并获取外接矩形
        self.image = pygame.image.load('code\images\ship.bmp')
        self.image = pygame.transform.scale(self.image, (self.height,self.weight))       #改变图片大小
        self.rect = self.image.get_rect()
        #飞机位置
        self.rect.midbottom = self.screen_rect.midbottom

        #飞机持续移动，开火判定
        self.moving_right = False
        self.moving_left = False
        self.moving_up = False
        self.moving_down = False
        self.fire = False

    def blitme(self):
        #指定位置绘制飞船
        self.screen.blit(self.image,self.rect)

   